<template>
	<view class="conten">
		<!-- <topbar :top="top"></topbar> -->
		<view class="Store">
			<view class="Store-head">
				<view class="head-left">
					<u-icon name="account-fill" color="#6395FA" size="35"></u-icon>
					<text>门店列表</text>
				</view>
			</view>

		</view>
		<!-- 账号操作 -->
		<view class="shop-list" v-for="(item,index) in itemList" :key="index" @click="pathhome(item)">
			<view class="list-left">
				<text class="txt1">{{item.name}}</text>
				<text class="txt2">门店ID{{item.id}}</text>
			</view>
			<view class="list-right">
				<u-icon name="arrow-right" color="#2979ff" size="35"></u-icon>
			</view>
		</view>
		<view class="addbtn">
			<u-button type="primary" shape="circle" @click="addshop">新增门店</u-button>
		</view>
	</view>
</template>

<script>
	import topbar from "@/components/topnav/topnav.vue"
	import {
		shop
	} from "../../api/merchant/index.js"
	export default {
		components: {
			topbar
		},
		data() {
			return {
				
				id: "",
				itemStyle: {
					paddingTop: "30rpx",
					paddingLeft: "30rpx",
					borderBottom: "1rpx solid #f5f5f5",
					fontSize: "28rpx"
				},
				value: "7428392",
				current: {
					pic: require('../../static/img/dp.png'),
					name: "N多寿司(新世界店)",
					num: "4628782392",
					id: "7428392",
					disabled: false
				},
				itemList: [

				],
				top: {
									drristo:true,
									titlesize: 60,
									title: '切换门店',
									center: false,
									slotRight: false,
									backText: '',
									backIconName: 'nav-back',
									right: false,
									showAction: false,
									rightSlot: false,
									useSlot: false,
									background: {
										background: '#fff'
									},
									isBack: true,
									search: false,
									custom: false,
									isFixed: true,
									keyword: '',
									isicon:true,
									icon:"",
									istext:false
								},
			}

		},
		onShow() {
			this.id = uni.getStorageSync("addmerchantid")
			shop({
				merchantId: this.id
			}).then(res => {
				console.log(res)
				if (res.code == 0) {
					
					this.itemList = res.data
				}
			})
		},
		methods: {
			tourl(e) {
				console.log(e)
				if (e === 0) {
					uni.reLaunch({
						url: "/pages/merchant/switchover"
					});
				}
			},
			// 新增门店
			addshop() {
				uni.navigateTo({
					url: "/pages/merchant/addshop"
				})
			},
			// 跳转主页
			pathhome(item) {
				console.log(item)
				uni.setStorageSync("shoplist",item)
				uni.setStorageSync("shop_id",item.id)
				uni.navigateTo({
					url: '/pages/pay/pay?shop_id=' + item.id
				})
			}
		}

	}
</script>

<style lang="scss" scoped>
	page{
		background-color: #FFFFFF;
	}
	.conten {
		width: 100%;
		height: 100%;
		padding-top: 50rpx;
		background-color: #FFFFFF;
	}

	.nowaday {
		display: flex;
		width: 690rpx;
		padding: 30rpx;
		background-color: #FFFFFF;

		.nowaday-pic {
			width: 100rpx;
			height: 100rpx;
			border-radius: 50%;
			margin-right: 20rpx;
		}

		.nowaday-txt {
			display: flex;
			flex-direction: column;

			.txt-nav {
				margin-bottom: 10rpx;

				.txt-nav1 {
					font-size: 34rpx;
					color: #333333;
					line-height: 48rpx;
					font-weight: bold;
				}

				.txt-nav2 {
					width: 45rpx;
					height: 24rpx;
					margin-left: 25rpx;
					padding: 6rpx;
					text-align: center;
					font-size: 20rpx;
					line-height: 24rpx;
					color: #3D7FFF;
					background: rgba(61, 127, 255, 0.1);
					border-radius: 6px;
				}
			}

			.txt-center {
				margin-bottom: 10rpx;
				color: #666666;
				font-size: 28rpx;
				line-height: 40rpx;

			}

			.txt-id {
				font-size: 24rpx;
				color: #999999;
				line-height: 33rpx;
			}
		}
	}

	// 门店管理
	.Store {
		width: 670rpx;
		padding: 40rpx;
		background-color: #FFFFFF;

		.Store-head {
			display: flex;
			justify-content: space-between;
			padding-bottom: 20rpx;
			border-bottom: 1rpx solid #F5F5F5;

			.head-left {
				display: flex;
				align-items: center;

				text {
					margin-left: 20rpx;
					font-size: 34rpx;
					color: #333333;
					font-weight: bold;
				}
			}

			.head-right {
				font-size: 30rpx;
				color: #6395FA;
			}
		}
	}

	// 下拉菜单
	.shop-list {
		display: flex;
		justify-content: space-between;
		align-items: center;
		width: 690rpx;
		padding: 30rpx;
		margin: 20rpx auto;
		background-color: #f2f2f2;

		.list-left {
			display: flex;
			flex-direction: column;

			.txt1 {
				font-size: 34rpx;
				font-weight: bold;
				line-height: 48rpx;
			}

			.txt2 {
				margin-top: 10rpx;
				font-size: 24rpx;
				color: #999999;
			}
		}
	}

	.addbtn {
		width: 600rpx;
		height: 100rpx;
		margin: 0 auto;
		margin-top: 100rpx;
	}
</style>
